<?php

namespace app\api\controller\v1\task;

use app\model\plan\PlanStaff;
use app\services\face\CertService;

class TaskController
{
    public function cert()
    {

        $info = PlanStaff::where('progress' , 100)
            ->where('complete_status' , 10)
            ->where('task_status', '=', 1)
            ->order('id desc')->find() ;
        if($info == null){
            return '空' ;
        }


        $service = new CertService() ;
        $ret = $service->jieyeCheck($info['plan_id'] ,$info['staff_id'] , 0) ;
        if($ret == true){


            $info->task_status = 9 ;
            $info->save() ;
            return $service->getImageUrl() ;
        }
        return $service->getError() ;
    }

}